home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 44
/
Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso
/
-in_the_mag-
/
basics
/
blitz
/
blitz.i.lha
/
B.I.
/
Investigator.asc
< prev
next >
Wrap
Text File
|
1999-02-22
|
10KB
|
409 lines
;Blitz Private Investigator
;by Curt Esser
;camge@ix.netcom.com
;last modified Feb 22 1999
;PD - do whatever you want with it
;reads Blitz libraries and prints out a list of the commands
;to a console window, a printer, or disk files
;can read Deflibs and Amigalibs also
;ReqTools required!
WBStartup
NoCli
MaxLen source$=255
MaxLen path$=255
MaxLen svpath$=255
MaxLen svname$=255
MaxLen savepath$=255
z$=Chr$(10)
cxl$="Cancel Library Scan"
;-- read the tooltypes------------------
;set the defaults first:
size$="160/20/320/400"
Tsize$="160/20/320/400"
Wclose$="YES"
Tclose$="NO"
close$="/CLOSE/WAIT"
from$="Blitz2:"
saveto$="RAM:"
;if you don't have BSS
;substitute the name here:
ourname$=ProgName$ ;get the program's name
ok.l=GetIconObject(ourname$) ;read the tooltypes
If ok
temp$=FindToolValue("WB")
If temp$<>"" Then size$=temp$ ;size of wb window
temp$=FindToolValue("TED") ;size of Ted window
If temp$<>"" Then Tsize$=temp$
temp$=FindToolValue("WBCLOSE") ;auto close WB window?
If temp$<>"" Then Wclose$=temp$
temp$=FindToolValue("TEDCLOSE") ;auto close on Ted screen?
If temp$<>"" Then Tclose$=temp$
temp$=FindToolValue("FROM") ;default read path
If temp$<>"" Then from$=temp$
temp$=FindToolValue("SAVE") ;default save path
If temp$<>"" Then saveto$=temp$
FreeIconObject
EndIf
RTEZSetDefaultDirectory 2,saveto$
RTEZSetDefaultDirectory 3,from$
onTed.b=0 ;run on ted's screen?
If NumPars
For i = 1 To NumPars
If Par$(i)="TED" Then onTed=1
Next
EndIf
Windo$="CON:" ;set up parameters for the console window
If onTed
Windo$+Tsize$
Else
Windo$+size$
EndIf
Windo$+"/"+ourname$
If onTed
Windo$+"/SCREENSuperTED1"
If UCase$(Tclose$)<>"YES"
Windo$+close$
EndIf
Else
If UCase$(Wclose$)<>"YES"
Windo$+close$
EndIf
EndIf
; -- test strings for examining the libraries ----------------
ok$=Chr$(0)+Chr$(0)+Chr$(3)+Chr$(243) ;$000003F3 should be at 1st or 4th byte
ok1$=Chr$(0)+Chr$(0)+Chr$(3)+Chr$(233) ;$000003E9 should come after next 20 bytes
ok2$=Chr$(0)+"Nu"+Chr$(0) ;find the next lib in deflibs & acidlibs
; -- open a console window for the output -------------------
DosBuffLen 0 ;use no buffers for CON: or PRT: for immediate output!
FindScreen 0 ;I think we'll need one of these ;)
Window 0,0,0,1,1,0,"",0,0 ;invisible window for the requesters
answer.b=RTEZRequest (ourname$,"Save library information?","To Disk|Printer| No! ",2,1,4)
If answer=2
Windo$="CON:160/20/320/40/Printer Check/SCREENSuperTED1/NOSIZE"
EndIf
wind.l=OpenFile (1,Windo$)
If wind = 0
Request "ERROR!","Can't open console window","AAAARRRGGGGHHHH!"
End
EndIf
FileOutput 1 ;output to the console window
Select answer
Case 1 ;save to disk
savepath$=RTEZPathRequest ("Save data files to:")
tofile.b=1
Case 2 ;the printer
answer=RTEZRequest(ourname$,"Is your printer ready?","Get on with it!")
If OpenFile(3,"PRT:")
NPrint "Waiting on the printer..."
FileOutput 3
NPrint " "
NPrint "Blitz library information:"
NPrint " "
CloseFile 1
printer.b=1
cxl$="Cancel Printing"
EndIf
End Select
DosBuffLen 2048 ;we need 'em for the disk files...
Format "000"
Repeat
notBlitz.b=1
biglib.b=0
lyne$="_______________________________________________"
If printer=0 Then lyne$="-----------------------------------"
NPrint lyne$
NPrint " "
; ------- we need file(s) to read! ----------------------------
selected.l=RTEZMultiLoadFile(" Select Libraries to scan:")
lib$=RTNextPathEntry
If lib$="" Then Goto quit ;nothing selected - ie, CANCEL
; ------- panic button ----------------------------------------
chekrq.l=RTASyncRequest(" Panic Button",cxl$,"Enough!")
dumpit.b=0
While lib$<>"" AND dumpit=0 ;OK, read 'em all...
NPrint lyne$
NPrint " "
For i = Len(lib$) To 1 Step-1 ;pull out the file name
check$=Mid$(lib$,i,1)
If check$="/" OR check$=":"
source$=Mid$(lib$,i+1)
path$=Left$(lib$,i)
i=1
EndIf
Next
;EndIf
source$=UCase$(source$)
If source$="DEFLIBS" OR source$="ACIDLIBS" Then biglib=1
;If lib$=""Then Goto quit
If ReadFile(0,lib$) ;make sure it's a Blitz library!
FileInput 0
check$=Inkey$(4)
If check$=ok$
notBlitz=0
Else
check$=Inkey$(4)
If check$= ok$ Then notBlitz=0
EndIf
If notBlitz=0
check$=Inkey$(20)
check$=Inkey$(4)
If check$<>ok1$ Then notBlitz=1
EndIf
If notBlitz
rq$=source$+z$+"is not a Blitz library!"
dummy.b=RTEZRequest (ourname$,rq$,"OK")
Else
check$=Inkey$(4) ;throw away the next 4 bytes
a$=Inkey$(1)
If a$="p" ;ah, a standard Blitz lib
syslib.b=0
Else ;no, must be an Amigalib
syslib=1
EndIf
; -- ok, now get the library number ---------------------------
Select syslib ;system libraries are a bit different...
Case 0 ;a Blitz style library (maybe deflibs or acidlibs)
FileSeek 0,28
While NOT Eof(0) AND dumpit=0
a.b=Asc(Inkey$(1))
If a=$70
a$=(Inkey$(4))
If a$=ok2$
a=Asc(Inkey$(1))
If a<>0
libnum.w=a AND $FF
Gosub ReadEm
If cmdnum.w>0 AND biglib=1
NPrint lyne$
NPrint " "
EndIf
EndIf
EndIf
EndIf
If dumpit=0
chekrq.l=RTCheckASyncRequest
If chekrq= 0
dumpit=1
Pop While:Pop Select
Goto dumped
EndIf
EndIf
Wend
Case 1 ;for system libs
FileSeek 0,37
a.b=Asc(Inkey$(1))
libnum.w= a AND $FF
NPrint " ",source$," Lib# ",libnum
NPrint " "
Gosub SysRead
End Select
EndIf
dumped
CloseFile 0
PopInput
EndIf
If dumpit=0
chekrq.l=RTCheckASyncRequest
If chekrq=0
lib$=""
dumpit=1
Else
lib$=RTNextPathEntry
EndIf
Else
lib$=""
EndIf
If lib$<>"" AND printer=0 Then VWait 100
Wend
If dumpit=0
RTEndASyncRequest
EndIf
RTEZSetDefaultDirectory 3,path$
Forever
ReadEm ;read the command names
;look for $FFFF0000 000000 00
done.b=0
firstcmd.b=0
cmdnum.w=0
Repeat
b.w=Asc(Inkey$(1))
If b=255
b.w=Asc(Inkey$(1))
If b=255 ;aha, two $FF's !
For i = 1 To 6 ;now the 6 $00's ?
b=Asc(Inkey$(1))
If b<>0 Then done=1 ;nope, must be the end of the command list!
Next
If done = 0
gotall.b=0
cmd$=""
a$=Inkey$(1)
If a$ = Chr$(0) ;another $00?
done=1
Else
If firstcmd=0 ;first command found!
NPrint source$," Lib# ",libnum
NPrint " "
If tofile ;this bit saves to disk file
Format ""
outpath$=savepath$+"Blib."+Str$(libnum)
Format "000"
If OpenFile(4,outpath$)=0
tofile=0
dummy.b= RTEZRequest (ourname$,"can't open output file!","OK")
Else
FileOutput 4
NPrint source$
FileOutput 1
EndIf
EndIf
firstcmd=1
EndIf
cmd$+a$
EndIf
If done=0 ;here we read the actual command string
cmdnum+1
Repeat
a$=Inkey$(1)
If a$>Chr$(35) AND a$<Chr$(126)
cmd$+a$
Else
gotall=1
EndIf
Until gotall
NPrint " ",Str$(cmdnum)," ",cmd$
If tofile
FileOutput 4
NPrint cmd$
FileOutput 1
EndIf
EndIf
EndIf
EndIf
EndIf
Until done
CloseFile 4
;If cmdnum>1
;NPrint "-> ",Str$(cmdnum)," commands"
;EndIf
NPrint " "
If biglib=1 AND cmdnum>0 AND tofile=0 Then VWait 100
Return
SysRead
; look for $FF0000 000000 00
; or $FF0000 000000 0000 in amigalibs!
cmdnum=0
done=0
If tofile ;save to disk
Format ""
If OpenFile(4,savepath$+"Blib."+Str$(libnum))=0
tofile=0
dummy.b= RTEZRequest (ourname$,"can't open output file!","OK")
Else
FileOutput 4
NPrint source$
FileOutput 1
EndIf
Format "000"
EndIf
Repeat
b.w=Asc(Inkey$(1))
If b=255 ;now look for 6 or 7 0's
b.w=Asc(Inkey$(1))
If b=255 ;in system libs, $FFFF means end of command list
b=Asc(Inkey$(1))
If b=0
done=1
EndIf
Else
If b=0 ;OK, now check for at least 6 $00's
gonext.b=0
For i = 1 To 5
b=Asc(Inkey$(1))
If b<>0 Then gonext.b=1
Next
If gonext=0
gotall.b=0
cmdnum+1
cmd$=""
a$=Inkey$(1)
If a$ = Chr$(0) ;sometimes there is one more $00
a$=Inkey$(1)
EndIf
cmd$+a$ ;now we read the command string
Repeat
a$=Inkey$(1)
If a$>Chr$(35) AND a$<Chr$(126) ;alphabetic character?
cmd$+a$
Else
gotall=1
EndIf
Until gotall
NPrint " ",Str$(cmdnum)," ",cmd$
If tofile
FileOutput 4 ;to the disk file
NPrint cmd$
FileOutput 1 ;back to the console
EndIf
EndIf
EndIf
EndIf
EndIf
Until done
CloseFile 4
Return
quit
CloseFile 1
CloseFile 3
CloseFile 4
End